package com.pengxun.manager.controller.system;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.pengxun.manager.model.system.PermissionCodeType;
import com.pengxun.manager.service.system.PermissionCodeTypeService;
import com.szeastroc.common.jdbc.page.Page;
import com.szeastroc.common.result.Result;
import com.szeastroc.common.result.ResultUtils;

@RestController
@RequestMapping("/permissionCodeType")
public class  PermissionCodeTypeController {

   @Resource
   private PermissionCodeTypeService permissionCodeTypeService;
   
   @RequestMapping("/insert")
   public Result insert(PermissionCodeType permissionCodeType){
       try{
          permissionCodeTypeService.insert(permissionCodeType);
       } catch (Exception e) {
			return ResultUtils.renderError(e.getMessage());
	   }
	   return ResultUtils.render();
   };
   
   @RequestMapping("/update")
   public Result update(PermissionCodeType permissionCodeType){
        try{
          permissionCodeTypeService.update(permissionCodeType);
       } catch (Exception e) {
			return ResultUtils.renderError(e.getMessage());
	   }
	   return ResultUtils.render();
   };
   
   @RequestMapping("/delete")
   public Result delete(Integer id){
       try{
          permissionCodeTypeService.delete(id);
       } catch (Exception e) {
			return ResultUtils.renderError(e.getMessage());
	   }
	   return ResultUtils.render();
   };
   
   @RequestMapping("/findByPage")
   public Result findByPage(Page page) {
		page = permissionCodeTypeService.findByPage(page);
		return ResultUtils.render(page);
	};
	
   @RequestMapping("/findById")
   public Result findById(Integer id) {
		PermissionCodeType permissionCodeType = permissionCodeTypeService.findById(id);
		return ResultUtils.render(permissionCodeType);
	};
	
	@RequestMapping("/findAll")
	   public Result findAll() {
			List<PermissionCodeType> list = permissionCodeTypeService.findAll();
			return ResultUtils.render(list);
		};
}
